package com.lphl.pet.util;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

import com.lphl.pet.R;


public class MenuDialogUtil {

	private static MenuDialogUtil dialogUtil = null;
	private MenuDialogUtil(){}
	public static MenuDialogUtil getInstance(){
		if(dialogUtil == null){
			dialogUtil = new MenuDialogUtil();
		}
		return dialogUtil;
	}
	
	public void showUnbindDialog(final Context ct){
		final Dialog dialog = new Dialog(ct, R.style.Dialog);
		dialog.setContentView(R.layout.yh_card_dialog);
		dialog.getWindow().setLayout(dialog.getWindow().getWindowManager().getDefaultDisplay().getWidth(),
				dialog.getWindow().getAttributes().WRAP_CONTENT);

        // 以下设置三个TextView 的数据
		TextView tv_message = (TextView) dialog.findViewById(R.id.tv_message);
		tv_message.setText(ct.getResources().getString(R.string.first_menu_dialog_unbind_content));
		
		TextView tv_understand_info = (TextView) dialog.findViewById(R.id.tv_understand_info);
		tv_understand_info.setText(ct.getResources().getString(R.string.first_menu_dialog_btn_unbind));
		
		TextView know = (TextView) dialog.findViewById(R.id.tv_i_know);
		know.setText(ct.getResources().getString(R.string.first_menu_dialog_btn_error));
		
		know.setOnClickListener(new OnClickListener() {
				
			@Override
			public void onClick(View v) {
				dialog.dismiss();
			}
		});
		
		tv_understand_info.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
                // 了解更多信息
                Toast.makeText(ct, "了解下", 0).show();
			}
		});
		dialog.show();
	}
	public void showDeleteDialog(final Context ct){
		final Dialog dialog = new Dialog(ct, R.style.Dialog);
		dialog.setContentView(R.layout.yh_card_dialog);
		dialog.getWindow().setLayout(dialog.getWindow().getWindowManager().getDefaultDisplay().getWidth(),
				dialog.getWindow().getAttributes().WRAP_CONTENT);

        // 以下设置三个TextView 的数据
		TextView tv_message = (TextView) dialog.findViewById(R.id.tv_message);
		tv_message.setText(ct.getResources().getString(R.string.first_menu_dialog_delete));
		
		TextView tv_understand_info = (TextView) dialog.findViewById(R.id.tv_understand_info);
		tv_understand_info.setText(ct.getResources().getString(R.string.first_menu_dialog_btn_delete));
		
		TextView know = (TextView) dialog.findViewById(R.id.tv_i_know);
		know.setText(ct.getResources().getString(R.string.first_menu_dialog_btn_error));
		
		know.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				dialog.dismiss();
			}
		});
		
		tv_understand_info.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
                // 了解更多信息
                Toast.makeText(ct, "了解下", 0).show();
			}
		});
		dialog.show();
	}
}
